import { createNativeStackNavigator } from '@react-navigation/native-stack'
import Home from './home/index'
import Login from './Login'
import { useAuth } from '../components/AuthProvider'

const Stack = createNativeStackNavigator()

export default function Screen() {
  const { isAuthenticated } = useAuth()

  return (
    <Stack.Navigator>
      {/* 如果已认证，显示主页面 */}
      {isAuthenticated ? (
        <Stack.Screen name="home" component={Home} options={{ header: () => null }} />
      ) : (
        <Stack.Screen name="login" component={Login} options={{ header: () => null }} />
      )}
    </Stack.Navigator>
  )
}
